Class GitHub

1 Introduction

Introduce your project: research question, variables, design of visualization

1.1 Subtopic

Sample links

Edward Tufte is one of the earliest data scientists emphasizing visual thinking. He postulates that one should first learn to read data, before moving on to visualize. He suggests training the visual thinking, then preparing the educated eyes. His newest book is titled SEEING WITH FRESH EYES: MEANING, SPACE, DATA, TRUTH, vividly testifying his philosophy of connecting the human perception with the data message.

Edward Tufte

Seeing with Fresh Eyes: Meaning, Space, Data, Truth

More on your research. You can also use both Markdown and HTML




1.2 Example1: Multi-dimensional plot of data

# my_packages <- c("tidyverse", "png","gifski", "gapminder", "ggplot2","gganimate","RColorBrewer")
# install.packages(my_packages, repos = "http://cran.rstudio.com")
# Take sometime to render charts

library(gapminder)
library(ggplot2)
library(gganimate)
library(gifski)
library(png)
library(RColorBrewer)

data("gapminder")
# Basic scatter plot object

mapping <- aes(x =gdpPercap, y = lifeExp, 
               size = pop, color = continent,
               frame = year) 

# Note: manual color choices.

ggplot(gapminder, mapping = mapping) +
  geom_point() +
  theme_linedraw() + 
  scale_x_log10() +
  scale_color_manual(values=c("darkviolet","darkblue","firebrick1","forestgreen","deepskyblue1")) +
  labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
  geom_text(aes(label=ifelse((country == "China"), "China", ifelse(country=="United States", "United States", ""))),vjust=0,nudge_y = 1,size=6) +
  transition_time(year) +
  ease_aes('linear') +
  theme(text=element_text(family="Palatino"))

1.3 Example2: Interactive charts using rbokeh


1.3.1 Sample interactive chart using rbokeh: shape + color + hover function

figure(width = NULL, height = NULL) %>%
  ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species, glyph = Species, size = 5, hover = list(Sepal.Length, Sepal.Width)) %>% 
  theme_axis(axis_label_text_font = "Palatino")

1.3.2 Sample interactive chart using rbokeh: quantile plot

figure(width = NULL, height = NULL, legend_location = "top_left") %>%
  ly_quantile(Sepal.Length, group = Species, data = iris, size= 4,
  hover = list(Sepal.Length)) %>% 
  theme_axis(axis_label_text_font = "Palatino")

1.3.3 Sample interactive chart using rbokeh: color scales only

figure(width = NULL, height = NULL, legend_location = "NULL") %>%
  ly_points(Sepal.Length, Sepal.Width, data = iris, size = 4,
            color = Petal.Width, 
            hover = list(Sepal.Length, Sepal.Width)) %>% 
  theme_axis(axis_label_text_font = "Palatino")

1.4 Example 3: Insert your Shiny app (published on your shinyapp.io account)